package com.project.util;

import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class loginInterSet implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        String username=(String) request.getSession().getAttribute("loginUser");
       if (username==null){//没有登录用户的信息，非法用户
           response.sendRedirect("/login.html?errorInfo=noland");
           return false;
       }
        return true;
    }
}
